package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.pojo.Question;
import com.itheima.service.QuestionService;
import com.itheima.utils.Count;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 春夏_x
 * @date 2019-12-15 15:00
 */
@RestController
@RequestMapping("/question")
public class QuestionController {

    @Reference
    private QuestionService questionService;

    @RequestMapping("/findAll")
    public Result findAll(Integer onetotal){
        try {
            Question all = questionService.findAll(onetotal);
//            if (Count.count== Count.questions.size()){
//                return new Result(false,"您的分值为",Count.total);
//            }
            return new Result(true,"查询题目列表成功",all);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,"查询题目列表失败");
        }
    }
}
